home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / getrlimit.man < prev    next >
Encoding:
Text File  |  1990-01-24  |  5.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4. GETRLIMIT             C Library Procedures              GETRLIMIT
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      getrlimit, setrlimit - control maximum system resource con-
  10.      sumption
  11.  
  12. SSYYNNOOPPSSIISS
  13.      ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
  14.      ##iinncclluuddee <<ssyyss//rreessoouurrccee..hh>>
  15.  
  16.      ggeettrrlliimmiitt((rreessoouurrccee,, rrllpp))
  17.      iinntt rreessoouurrccee;;
  18.      ssttrruucctt rrlliimmiitt **rrllpp;;
  19.  
  20.      sseettrrlliimmiitt((rreessoouurrccee,, rrllpp))
  21.      iinntt rreessoouurrccee;;
  22.      ssttrruucctt rrlliimmiitt **rrllpp;;
  23.  
  24. DDEESSCCRRIIPPTTIIOONN
  25.      Limits on the consumption of system resources by the current
  26.      process and each process it creates may be obtained with the
  27.      _g_e_t_r_l_i_m_i_t call, and set with the _s_e_t_r_l_i_m_i_t call.
  28.  
  29.      The _r_e_s_o_u_r_c_e parameter is one of the following:
  30.  
  31.      RLIMIT_CPU       the maximum amount of cpu time (in seconds)
  32.                       to be used by each process.
  33.  
  34.      RLIMIT_FSIZE     the largest size, in bytes, of any single
  35.                       file that may be created.
  36.  
  37.      RLIMIT_DATA      the maximum size, in bytes, of the data
  38.                       segment for a process; this defines how far
  39.                       a program may extend its break with the
  40.                       _s_b_r_k(2) system call.
  41.  
  42.      RLIMIT_STACK     the maximum size, in bytes, of the stack
  43.                       segment for a process; this defines how far
  44.                       a program's stack segment may be extended.
  45.                       Stack extension is performed automatically
  46.                       by the system.
  47.  
  48.      RLIMIT_CORE      the largest size, in bytes, of a _c_o_r_e file
  49.                       that may be created.
  50.  
  51.      RLIMIT_RSS       the maximum size, in bytes, to which a
  52.                       process's resident set size may grow.  This
  53.                       imposes a limit on the amount of physical
  54.                       memory to be given to a process; if memory
  55.                       is tight, the system will prefer to take
  56.                       memory from processes that are exceeding
  57.                       their declared resident set size.
  58.  
  59.      A resource limit is specified as a soft limit and a hard
  60.  
  61.  
  62.  
  63. Sprite v1.0               April 3, 1987                         1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GETRLIMIT             C Library Procedures              GETRLIMIT
  71.  
  72.  
  73.  
  74.      limit.  When a soft limit is exceeded a process may receive
  75.      a signal (for example, if the cpu time or file size is
  76.      exceeded), but it will be allowed to continue execution
  77.      until it reaches the hard limit (or modifies its resource
  78.      limit).  The _r_l_i_m_i_t structure is used to specify the hard
  79.      and soft limits on a resource,
  80.  
  81.           struct rlimit {
  82.                int  rlim_cur; /* current (soft) limit */
  83.                int  rlim_max; /* hard limit */
  84.           };
  85.  
  86.      Only the super-user may raise the maximum limits.  Other
  87.      users may only alter _r_l_i_m__c_u_r within the range from 0 to
  88.      _r_l_i_m__m_a_x or (irreversibly) lower _r_l_i_m__m_a_x.
  89.  
  90.      An "infinite" value for a limit is defined as RLIM_INFINITY
  91.      (0x7fffffff).
  92.  
  93.      Because this information is stored in the per-process infor-
  94.      mation, this system call must be executed directly by the
  95.      shell if it is to affect all future processes created by the
  96.      shell; _l_i_m_i_t is thus a built-in command to _c_s_h(1).
  97.  
  98.      The system refuses to extend the data or stack space when
  99.      the limits would be exceeded in the normal way: a _b_r_e_a_k call
  100.      fails if the data space limit is reached.  When the stack
  101.      limit is reached, the process receives a segmentation fault
  102.      (SIGSEGV); if this signal is not caught by a handler using
  103.      the signal stack, this signal will kill the process.
  104.  
  105.      A file I/O operation that would create a file larger that
  106.      the process' soft limit will cause the write to fail and a
  107.      signal SIGXFSZ to be generated; this normally terminates the
  108.      process, but may be caught.  When the soft cpu time limit is
  109.      exceeded, a signal SIGXCPU is sent to the offending process.
  110.  
  111. RREETTUURRNN VVAALLUUEE
  112.      A 0 return value indicates that the call succeeded, changing
  113.      or returning the resource limit.   A return value of -1
  114.      indicates that an error occurred, and an error code is
  115.      stored in the global location _e_r_r_n_o.
  116.  
  117. EERRRROORRSS
  118.      The possible errors are:
  119.  
  120.      [EFAULT]       The address specified for _r_l_p is invalid.
  121.  
  122.      [EPERM]   The limit specified to _s_e_t_r_l_i_m_i_t would have
  123.                     raised the maximum limit value, and the
  124.                     caller is not the super-user.
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               April 3, 1987                         2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. GETRLIMIT             C Library Procedures              GETRLIMIT
  137.  
  138.  
  139.  
  140. SSEEEE AALLSSOO
  141.      csh(1), quota(2), sigvec(2), sigstack(2)
  142.  
  143. BBUUGGSS
  144.      There should be _l_i_m_i_t and _u_n_l_i_m_i_t commands in _s_h(1) as well
  145.      as in _c_s_h.
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0               April 3, 1987                         3
  196.  
  197.  
  198.  
  199.